package cn.hpclub.server.service;

import java.util.concurrent.ConcurrentHashMap;

import cn.hpclub.server.constant.Constant;
import cn.hpclub.server.util.QueryHelper;

public class PaperlessInfoService{

    public static final PaperlessInfoService service = new PaperlessInfoService();

    public QueryHelper getListHelper(ConcurrentHashMap<String, String> searchInfo){
        QueryHelper helper = new QueryHelper("select *",Constant.Table.TABLE_PAPERLESS_INFO,"pl");
        helper.addCondition(searchInfo.containsKey("isnfc") && !"-1".equals(searchInfo.get("isnfc")),"pl.isnfc=?",searchInfo.get("isnfc"));
        helper.addCondition(searchInfo.containsKey("flow_id"),"pl.flow_id=?",searchInfo.get("flow_id"));
        helper.addCondition(searchInfo.containsKey("work_no"),"pl.work_no=?",searchInfo.get("work_no"));
        helper.addCondition(searchInfo.containsKey("phone_no"),"pl.phone_no=?",searchInfo.get("phone_no"));
        helper.addCondition(searchInfo.containsKey("name"),"pl.name like ?","%"+searchInfo.get("name")+"%");
        helper.addCondition(searchInfo.containsKey("cust_name"),"pl.cust_name like ?","%"+searchInfo.get("cust_name")+"%");
        helper.addCondition(searchInfo.containsKey("card_no"),"pl.card_no=?",searchInfo.get("card_no"));
        helper.addCondition(searchInfo.containsKey("phone_no"),"pl.phone_no=?",searchInfo.get("phone_no"));
        helper.addCondition(searchInfo.containsKey("start_time"),"pl.create_time>=?",searchInfo.get("start_time")+" 00:00:00");
        helper.addCondition(searchInfo.containsKey("end_time"),"pl.create_time<=?",searchInfo.get("end_time")+" 23:59:59");
        return helper;
    }

}
